﻿@model CSF.WebApp.Admin.Models.MultiLangInputModel
@{
    IEnumerable<CSF.MultiLang.Data.LangDef> langDefs = ViewBag.LangDefs;
    string listname = Model.ListParameterName;
    string containerId = Model.ContainerId;
    string defaultContentId = listname + "DefaultContent";
    string anchorSelector = Model.AnchorSelector;
    string defaultInputSelector = Model.DefaultInputSelector;
    int i = 0;
}
<div style="display:none">
     <div id="@(containerId)">
        <table cellpadding="1" cellspacing="1" border="0" style="width: 40em">
            <thead>
                <tr>
                    <th>Language</th>
                    <th>Text</th>
                </tr>
            </thead>
            <tbody>
            @foreach (var lang in langDefs)
            {
                if (i == 0)
                {
                <tr>
                    <td align="center"><label>@lang.LangName</label></td>
                    <td align="center"><input id="@(defaultContentId)" type="text" readonly="readonly" value="@Model.DefaultText" style="width: 30em" /> </td>
                </tr>
                }
                else
                {
                <tr>
                    <td align="center">@Html.Hidden(listname + "[" + i.ToString() + "].LangId", lang.Id)<label>@lang.LangName</label></td>
                    <td align="center"><input name="@(listname)[@(i)].Content" type="text" value="" style="width: 30em" /></td>
                </tr>
                }
                i++;
            }
            </tbody>
        </table>
     </div>
</div>
<script language="javascript" type="text/javascript">
    $("@(anchorSelector)").fancybox({
        'transitionIn': 'elastic',
        'transitionOut': 'elastic',
        'speedIn': 600,
        'speedOut': 200,
        'onStart': function () {
            $('#@(defaultContentId)').val($('@(defaultInputSelector)').val());
        }
    });
</script>